<!DOCTYPE html>
<html>
<head>
    <title>契税打印</title>
    <#include "../../common/common.ftl"/>
    <link rel="stylesheet" href="/style/contractForm.css" media="all">

</head>
<body style="overflow-y: hidden;">
<div class="layui-fluid">
    <blockquote class="layui-elem-quote layui-bg-white">
        契税表格【姓名：<span class="jmdf-color-red">${(contract.name)!}</span>】【协议编号：<span
                class="jmdf-color-red">${(contract.contractCode)!}</span>】
        <button id="excelButton1" class="layui-btn layui-btn-sm"><i
                    class="layui-icon layui-icon-layim-download"></i>导出计收契税明细表
        </button>
        <button id="excelButton2" class="layui-btn layui-btn-sm"><i
                    class="layui-icon layui-icon-layim-download"></i>导出计收契税情况表
        </button>
    </blockquote>
    <div class="layui-row layui-col-space15">
        <div class="layui-col-lg4 layui-col-md4">
            <div class="layui-card">
                <div class="layui-card-body">
                    <form class="layui-form" id="deedTaxForm">
                        <input type="hidden" name="contractId" value="${(contract.id)!}"/>
                        <div class="layui-card">
                            <div class="layui-form-item">
                                <table class="layui-table">
                                    <tr>
                                        <th style="text-align: center;min-width: 80px">面积类型</th>
                                        <th style="text-align: center;min-width: 80px">面积</th>
                                        <th style="text-align: center;min-width: 80px">扣除面积</th>
                                        <th style="text-align: center;min-width: 80px">单价</th>
                                    </tr>
                                    <tr>
                                        <td style="text-align: center">产权调换</td>
                                        <td style="text-align: center">${(contract.propertyChangeArea)!}</td>
                                        <td style="text-align: center"><input type="text" style="width: 80px"
                                                                              class="layui-input"
                                                                              lay-verify="bigDecimal"
                                                                              name="kcPropertyChangeArea"
                                                                              value="${(contract.kcPropertyChangeArea)!}"/>
                                        </td>
                                        <td style="text-align: center"><input type="text" style="width: 80px"
                                                                              class="layui-input"
                                                                              lay-verify="bigDecimal"
                                                                              name="propertyChangeAreaPrice"
                                                                              value="${(contract.propertyChangeAreaPrice)!}"/>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="text-align: center">${(careBuyAreaNameList[0])!}</td>
                                        <td style="text-align: center">${(contract.careBuyArea1)!}</td>
                                        <td style="text-align: center"><input type="text" style="width: 80px"
                                                                              class="layui-input"
                                                                              lay-verify="bigDecimal"
                                                                              name="ckCareBuyArea1"
                                                                              value="${(contract.ckCareBuyArea1)!}"/>
                                        </td>
                                        <td style="text-align: center"><input type="text" style="width: 80px"
                                                                              class="layui-input"
                                                                              lay-verify="bigDecimal"
                                                                              name="careBuyArea1Price"
                                                                              value="${(contract.careBuyArea1Price)!}"/>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="text-align: center">${(careBuyAreaNameList[1])!}</td>
                                        <td style="text-align: center">${(contract.careBuyArea2)!}</td>
                                        <td style="text-align: center"><input type="text" style="width: 80px"
                                                                              class="layui-input"
                                                                              lay-verify="bigDecimal"
                                                                              name="ckCareBuyArea2"
                                                                              value="${(contract.ckCareBuyArea2)!}"/>
                                        </td>
                                        <td style="text-align: center"><input type="text" style="width: 80px"
                                                                              class="layui-input"
                                                                              lay-verify="bigDecimal"
                                                                              name="careBuyArea2Price"
                                                                              value="${(contract.careBuyArea2Price)!}"/>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="text-align: center">${(careBuyAreaNameList[2])!}</td>
                                        <td style="text-align: center">${(contract.careBuyArea3)!}</td>
                                        <td style="text-align: center"><input type="text" style="width: 80px"
                                                                              class="layui-input"
                                                                              lay-verify="bigDecimal"
                                                                              name="ckCareBuyArea3"
                                                                              value="${(contract.ckCareBuyArea3)!}"/>
                                        </td>
                                        <td style="text-align: center"><input type="text" style="width: 80px"
                                                                              class="layui-input"
                                                                              lay-verify="bigDecimal"
                                                                              name="careBuyArea3Price"
                                                                              value="${(contract.careBuyArea3Price)!}"/>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="text-align: center">${(careBuyAreaNameList[3])!}</td>
                                        <td style="text-align: center">${(contract.careBuyArea4)!}</td>
                                        <td style="text-align: center"><input type="text" style="width: 80px"
                                                                              class="layui-input"
                                                                              lay-verify="bigDecimal"
                                                                              name="ckCareBuyArea4"
                                                                              value="${(contract.ckCareBuyArea4)!}"/>
                                        </td>
                                        <td style="text-align: center"><input type="text" style="width: 80px"
                                                                              class="layui-input"
                                                                              lay-verify="bigDecimal"
                                                                              name="careBuyArea4Price"
                                                                              value="${(contract.careBuyArea4Price)!}"/>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="text-align: center">${(careBuyAreaNameList[4])!}</td>
                                        <td style="text-align: center">${(contract.careBuyArea5)!}</td>
                                        <td style="text-align: center"><input type="text" style="width: 80px"
                                                                              class="layui-input"
                                                                              lay-verify="bigDecimal"
                                                                              name="ckCareBuyArea5"
                                                                              value="${(contract.ckCareBuyArea5)!}"/>
                                        </td>
                                        <td style="text-align: center"><input type="text" style="width: 80px"
                                                                              class="layui-input"
                                                                              lay-verify="bigDecimal"
                                                                              name="careBuyArea5Price"
                                                                              value="${(contract.careBuyArea5Price)!}"/>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="text-align: center">${(careBuyAreaNameList[5])!}</td>
                                        <td style="text-align: center">${(contract.careBuyArea6)!}</td>
                                        <td style="text-align: center"><input type="text" style="width: 80px"
                                                                              class="layui-input"
                                                                              lay-verify="bigDecimal"
                                                                              name="ckCareBuyArea6"
                                                                              value="${(contract.ckCareBuyArea6)!}"/>
                                        </td>
                                        <td style="text-align: center"><input type="text" style="width: 80px"
                                                                              class="layui-input"
                                                                              lay-verify="bigDecimal"
                                                                              name="careBuyArea6Price"
                                                                              value="${(contract.careBuyArea6Price)!}"/>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="text-align: center">${(careBuyAreaNameList[6])!}</td>
                                        <td style="text-align: center">${(contract.careBuyArea7)!}</td>
                                        <td style="text-align: center"><input type="text" style="width: 80px"
                                                                              class="layui-input"
                                                                              lay-verify="bigDecimal"
                                                                              name="ckCareBuyArea7"
                                                                              value="${(contract.ckCareBuyArea7)!}"/>
                                        </td>
                                        <td style="text-align: center"><input type="text" style="width: 80px"
                                                                              class="layui-input"
                                                                              lay-verify="bigDecimal"
                                                                              name="careBuyArea7Price"
                                                                              value="${(contract.careBuyArea7Price)!}"/>
                                        </td>
                                    </tr>
                                    <#if careBuyAreaNameList[7]??>
                                        <tr>
                                            <td style="text-align: center">${(careBuyAreaNameList[7])!}</td>
                                            <td style="text-align: center">${(contract.careBuyArea8)!}</td>
                                            <td style="text-align: center"><input type="text" style="width: 80px"
                                                                                  class="layui-input"
                                                                                  lay-verify="bigDecimal"
                                                                                  name="ckCareBuyArea8"
                                                                                  value="${(contract.ckCareBuyArea8)!}"/>
                                            </td>
                                            <td style="text-align: center"><input type="text" style="width: 80px"
                                                                                  class="layui-input"
                                                                                  lay-verify="bigDecimal"
                                                                                  name="careBuyArea8Price"
                                                                                  value="${(contract.careBuyArea8Price)!}"/>
                                            </td>
                                        </tr>
                                    </#if>
                                    <tr>
                                        <td style="text-align: center">税费基数</td>
                                        <td style="text-align: center" colspan="3">
                                            <input type="radio"
                                                   <#if (!contract.sfJs?? || contract.sfJs == 1.05)>checked</#if>
                                                   name="sfJs" value="1.05" title="1.05"/>
                                            <input type="radio"
                                                   <#if (contract.sfJs?? && contract.sfJs == 1.09)>checked</#if>
                                                   name="sfJs" value="1.09" title="1.09"/>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="layui-card-body">
                    <button class="layui-btn layui-btn-fluid" lay-submit="" lay-filter="submit">保存</button>
                </div>
            </div>
        </div>
        <div class="layui-col-lg8 layui-col-md8">
            <div class="layui-card">
                <div class="layui-tab layui-tab-brief" id="deedTax">
                    <ul class="layui-tab-title">
                        <li source="/pdf/print/deedTaxPrint?contractId=${(contract.id)!}" class="layui-this">
                            契税明细表
                        </li>
                        <#--                        <li source="/pdf/print/deedTaxFourPrint?contractId=${(contract.id)!}">契税四方会签表</li>-->
                        <li source="/pdf/print/deedTaxForTaxDepartmentPrint?contractId=${(contract.id)!}">税务部门</li>
                    </ul>
                    <iframe id="printIframe" style="width: 100%;height: 730px;margin-top: 10px"></iframe>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script src="/layui/layui.js" charset="utf-8"></script>
<script src="/bigDecimal/BigDecimal-all-last.js"></script>
<script src="/bigDecimal/BigDecimal-all-last.min.js"></script>
<script src="/bigDecimal/common.js"></script>
<script>
    layui.config({
        base: '/modules/' //静态资源所在路径
    }).use(['jquery', 'layer', 'element', 'jmdf', 'verify', 'form'], function () {
        var $ = layui.jquery, form = layui.form, jmdf = layui.jmdf, layer = layui.layer, verify = layui.verify,
            element = layui.element;

//        打印链接调用
        function openPdf(source) {
            var url = source + "#toolbar=0";
            $("#printIframe").attr("src", url);
        }

        $("#deedTax li").click(function () {
            var source = $(this).attr("source");
            openPdf(source);
        });
        openPdf($("#deedTax li").attr("source"));


        //保存面积单价
        form.on('submit(submit)', function (data) {
            $.ajax({
                url: "setDeedTaxPrice",
                type: "post",
                data: $("#deedTaxForm").serialize(),
                success: function (data) {
                    if (data.code == "0001") {
                        layer.msg(data.message, {anim: 0, icon: 1, time: 500}, function () {
                            location.reload();
                        });
                    } else {//失败
                        layer.msg(data.message, {anim: 6, icon: 2, time: 3000});
                    }
                }
            });
            return false;
        });

        //导出
        $("#excelButton1").click(function () {
            location.href = 'deedTaxExcel1?contractId=' + ${contract.id};
        });
        $("#excelButton2").click(function () {
            location.href = 'deedTaxExcel2?contractId=' + ${contract.id};
        });


    });

</script>
</html>
